using System;
namespace MicroMsg.Common.Algorithm
{
	public class TypeTransform
	{
		private static byte[] reverseByteArray(byte[] byte_0)
		{
			int num = byte_0.Length;
			byte[] array = new byte[num];
			for (int i = 0; i < num; i++)
			{
				array[i] = byte_0[num - 1 - i];
			}
			return array;
		}
		public static byte[] intToByteArrayLH(int int_0)
		{
			byte[] array = new byte[4];
			for (int i = 0; i < 4; i++)
			{
				int num = i * 8;
				array[i] = (byte)(int_0 >> num & 255);
			}
			return array;
		}
		public static byte[] longToByteArrayLH(long long_0)
		{
			byte[] array = new byte[8];
			for (int i = 0; i < 8; i++)
			{
				int num = i * 8;
				array[i] = (byte)(long_0 >> num);
			}
			return array;
		}
		public static byte[] intToByteArrayHL(int int_0)
		{
			return TypeTransform.reverseByteArray(TypeTransform.intToByteArrayLH(int_0));
		}
		public static byte[] longToByteArrayHL(long long_0)
		{
			return TypeTransform.reverseByteArray(TypeTransform.longToByteArrayLH(long_0));
		}
		public static int byteArrayLHToInt(byte[] byte_0)
		{
			return (int)(byte_0[3] & 255) << 24 | (int)(byte_0[2] & 255) << 16 | (int)(byte_0[1] & 255) << 8 | (int)(byte_0[0] & 255);
		}
		public static long byteArrayLHToLong(byte[] byte_0)
		{
			return (long)(((ulong)byte_0[7] & 255uL) << 56 | ((ulong)byte_0[6] & 255uL) << 48 | ((ulong)byte_0[5] & 255uL) << 40 | ((ulong)byte_0[4] & 255uL) << 32 | ((ulong)byte_0[3] & 255uL) << 24 | ((ulong)byte_0[2] & 255uL) << 16 | ((ulong)byte_0[1] & 255uL) << 8 | ((ulong)byte_0[0] & 255uL));
		}
		public static int byteArrayHLToInt(byte[] byte_0)
		{
			return (int)(byte_0[0] & 255) << 24 | (int)(byte_0[1] & 255) << 16 | (int)(byte_0[2] & 255) << 8 | (int)(byte_0[3] & 255);
		}
		public static long byteArrayHLToLong(byte[] byte_0)
		{
			return (long)(((ulong)byte_0[0] & 255uL) << 56 | ((ulong)byte_0[1] & 255uL) << 48 | ((ulong)byte_0[2] & 255uL) << 40 | ((ulong)byte_0[3] & 255uL) << 32 | ((ulong)byte_0[4] & 255uL) << 24 | ((ulong)byte_0[5] & 255uL) << 16 | ((ulong)byte_0[6] & 255uL) << 8 | ((ulong)byte_0[7] & 255uL));
		}
		public static int reverseInt(int int_0)
		{
			return TypeTransform.byteArrayHLToInt(TypeTransform.intToByteArrayLH(int_0));
		}
		public static long reverseLong(long long_0)
		{
			return TypeTransform.byteArrayHLToLong(TypeTransform.longToByteArrayLH(long_0));
		}
	}
}
